/**
 * DayState.java
 *
 * Provider: CoderDream's Studio
 *
 * History
 *	Date(DD/MM/YYYY)    Author          Description
 * ----------------------------------------------------------------------------
 *	Oct 29, 2007			XuLin	Created
 */
package com.coderdream.chapter19.state.a2;

public class DayState implements State {

	private static DayState singleton = new DayState();

	/**
	 * 构造函数为private
	 */
	private DayState() {
	}

	/**
	 * 取得唯一的对象实例
	 * 
	 * @return
	 */
	public static State getInstance() {
		return singleton;
	}

	/**
	 * 设定时间
	 * 
	 */
	public void doClock(Context context, int hour) {
		if (hour < 8 || 21 <= hour) {
			context.changeState(NightState.getInstance());
		}
	}

	/**
	 * 使用金库
	 */
	public void doUse(Context context) {
		context.recordLog("使用金库（白天）");

	}

	/**
	 * 警铃
	 */
	public void doAlarm(Context context) {
		context.callSecurityCenter("警铃（白天）");
	}

	/**
	 * 一般通话
	 */
	public void doPhone(Context context) {
		context.callSecurityCenter("一般通话（白天）");
	}

	/**
	 * 输出字符串
	 * 
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return "[晚间]";
	}

}
